POV-Ray : Newsgroups : povray.advanced-users : Math question for CSG : Re: Math question for CSG Server Time
29 Jul 2024 18:20:53 EDT (-0400)
  Re: Math question for CSG  
From: Anton Sherwood
Date: 12 May 2001 19:54:38
Message: <3AFDCD74.8AE230B8@pobox.com>
CreeD wrote:
> It's shaped like an equilateral triangle with the 3 points clipped
> off.  In other words, viewed from above it's a hexagon with 3 long
> sides and 3 short ones.  The short sides should equal exactly 1/3rd
> of the long ones.  Can someone give me the gist of how to come up
> with some exact coordinates for such a shape (or, ideally, post the
> code?)

The corners are all on a regular triangular lattice ...

	b = sqrt(3/4);	// sin(pi/3)

	P0 = < 0  , 0 >
	P1 = < 3  , 0 >
	P2 = < 3.5, b >
	P3 = < 2  ,4b >
	P4 = < 1  ,4b >
	P5 = <-0.5, b >

What you need most is the second coordinate of the centroid, which is
5b/3, or 5/sqrt(12) -- that's its distance from the line {P0,P1}. 
Subtract it from 4b to get 7b/3 = 7/sqrt(12), the distance from the
centroid to the line {P3,P4}.  Thus:

	intersection {
		plane {  z, 5/sqrt(12) }
		plane {  z, 5/sqrt(12) rotate  120*y }
		plane {  z, 5/sqrt(12) rotate -120*y }
		plane { -z, 7/sqrt(12) }
		plane { -z, 7/sqrt(12) rotate  120*y }
		plane { -z, 7/sqrt(12) rotate -120*y }
		}

-- 
Anton Sherwood  --  br0### [at] p0b0xcom  --  http://ogre.nu/
(not an advanced user)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.